import mySql from "../sql/index"
export default {
	route: '/login',
	async handle(params){
		let res:any =  await mySql.query({
			tableName: 'demo',
			condition(item){
				if(item.name === params.name && item.passwd === params.passwd){
					return true;
				}
				return false;
			}
		});
		return new Promise((resolve,reject)=>{
			if(res.code === 200 && res.data.length > 0){
				resolve({...res,data:res.data[0]});
			}else{
				resolve({...res,code:201,msg:'账号或密码错误'});
			}
		})
	}
}